<script type="text/javascript">
$(document).ready(function(){
    $("#button").click(function(){

      {php}
      if((request()->controller()=='Article' && request()->action()=='add') || (request()->controller()=='Article' && request()->action()=='adddymanic') || (request()->controller()=='Member' && request()->action()=='addimage') || (request()->controller()=='Member' && request()->action()=='addauthpic') || (request()->controller()=='Mall' && request()->action()=='add') || (request()->controller()=='Article' && request()->action()=='dealjubao') || (request()->controller()=='Flag' && request()->action()=='addsign') || (request()->controller()=='Tool' && request()->action()=='createuser') || (request()->controller()=='Member' && request()->action()=='dealrisk') || (request()->controller()=='Blindbox' && request()->action()=='add')){
      {/php}
   
      var images='';
      <?php if(!empty($name)){ ?>
      $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+=''+img
          }else{
            images+=','+img
          }
        }
      });
      if(images){
        $('#images').val(images);
      }else{
        $('#images').val();
      }
    
      <?php }else{?>
       $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+=''+img
          }else{
            images+=','+img
          }
        }
      });
      if(images){
        $('#images').val(images);
      }else{
        $('#images').val();
      }
        <?php }?>

      {php}}{/php}
 // alert(images)
 //      return;
        //  layer.alert('最少要上传图片集');
        // return false;
{php}
if(input('?url')){
  echo 'loading("#button button")'."\r\n";
}
{/php}
 
        ajaxFun("POST","",$(".form-horizontal").serialize(),"json",function(ret){
            if(ret){
                if(ret.ret){
                    swal_msg(ret.ret,'',"success",{php}if(input('?url')){echo input('url');}else{echo 0;}{/php})
                    {php}
if(input('?url')){
  echo 'loading("#button button",\'<i class="fa fa-check"></i> &nbsp;\'+ret.ret)';
}
{/php}
               
                    return false;
                }else{
                    layer.msg(ret.err)
                }
            }else{
                swal_msg("错误",ret,"error");
            }
            {php}
if(input('?url')){
{/php}
loadingClose("#button button",'<i class="fa fa-check"></i> &nbsp;{present name="name"}修改{else /}提交{/present}')
{php}
}
{/php}
             
        });
    });
});
$("#tubiao").click(function(){
 
    layer.open({
      type: 2,
      title: '上传图片',
      shadeClose: true,
      shade: 0.2,
      area: ['70%', '60%'],
      skin:'shangchuantup',
      content: '{:url("index/upload")}',
      shift:-1,
      scrollbar: false,
      moveType: 1,
      moveOut: true
    }); 
})

  $("#tubiao1").click(function(){

    layer.open({
      type: 2,
      title: '上传视频',
      shadeClose: true,
      shade: 0.2,
      area: ['70%', '60%'],
      skin:'shangchuantup',
      content: '{:url("index/uploadvideo")}',
      shift:-1,
      scrollbar: false,
      moveType: 1,
      moveOut: true
    });
  })

$("#tubiao2").click(function(){
 
    layer.open({
      type: 2,
      title: '上传图片',
      shadeClose: true,
      shade: 0.2,
      area: ['70%', '60%'],
      skin:'shangchuantup',
      content: '{:url("index/upload2")}',
      shift:-1,
      scrollbar: false,
      moveType: 1,
      moveOut: true
    }); 
})


  $("#tubiao3").click(function(){

    layer.open({
      type: 2,
      title: '上传音频',
      shadeClose: true,
      shade: 0.2,
      area: ['70%', '60%'],
      skin:'shangchuantup',
      content: '{:url("index/audioUploads")}',
      shift:-1,
      scrollbar: false,
      moveType: 1,
      moveOut: true
    });
  })

function html2Escape(sHtml) {
 return sHtml.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
}
</script>
<style type="text/css">
.tbutton{ 
  position: fixed;
  bottom:0px;
  width: 100%;
  background: #fff;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid #F5EFEF;
  z-index: 99999999999
}
#button{ width:120px; margin: 0 auto;}
.wrapper-content{ padding-bottom:500px;margin-bottom: 75px;}
</style>

<div class="tbutton">
  <div id="button"><button class="btn btn-w-m btn-primary" type="button"><i class="fa fa-check"></i> &nbsp;{present name="name"}修改{else /}提交{/present}</button></div>
</div>